﻿/*
 * SRSTransformLibrary
 * 
 * initial implementation : 20.11.2008
 *
 * Copyright (c) Adam Sida, asida@centrum.cz.
 * All rights reserved.
 * 
 * for license see Petra.Gis.License.txt
 */
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Petra.Gis.ReferenceSystemServices;
using Petra.Gis.ReferenceSystemServices.Transformations;


namespace Petra.Gis
{
  /// <summary>
  /// represents Library with predefined coordinate systems
  /// </summary>
  [DataContract(Name = "SrsTransformLibrary")]
  [KnownType(typeof(BursaWolfGeographicTransform))]
  [KnownType(typeof(MeasureUnitTransform))]
  [KnownType(typeof(StandardMolodenskyTransform))]
  [KnownType(typeof(XYQuadrantTransform))]
  [KnownType(typeof(GeographicGeocentricTransform))]
  public class SRSTransformLibrary
  {

    protected TransformList _transforms;




    /// <summary>
    /// xaml constructor
    /// </summary>
    public SRSTransformLibrary()
    {
      _transforms = new TransformList();

    }






    /// <summary>
    /// stores predefined collection of Petra.Gis transformations.
    /// this colection helps with datasources with different coordinate systems
    /// then this collection is searched for proper transform ;-)
    /// </summary>
    [DataMember(Name = "CrsList")]
    public TransformList Transformations
    {
      get { return _transforms; }
      set
      {
        if (value == null)
          throw new ArgumentException("Transforms can't be null");
        _transforms = value;
      }
    }









    public void Add(IEnumerable<SRSTransform> anotherTransformList)
    { 
      //SRSTransform tmp;

      foreach(SRSTransform t in anotherTransformList)
      {
        //tmp = this.SearchBy(cs.Metadata.Authority, cs.Metadata.AuthorityCode.ToString());
        //if(!tmp.EqualParams(cs,CsCompareType.SkipStorageUnits))
        this.Transformations.Add(t);
      }
    }







  }
}
